<template>
	<view>
		<!-- 地图显示 -->
		<view class="map-views">
			<map style="width: 100%; height: 300px;" id="myMap" scale="16" :latitude="address.lat" :longitude="address.lng" :markers="covers" @markertap="markertap">
			</map>
		</view>
	</view>
</template>

<script>
	export default {
		props:{
			address: {
			    type: Object,
			    default: () => ({
			        address: "",
			        cityid: 0,
			        cityname: "",
			        citynames: "",
			        citypath: "",
			        lat: 39.909,
			        lng: 116.39742,
			        mobile: "",
			        name: ""
			    })
			}
		},
		data() {
			return {
				covers: [{
					latitude: this.address.lat,
					longitude: this.address.lng,
					title: this.address.address,
					width: 30,
					height: 40
				}],
			}
		},
		methods: {
			markertap(){
				this.goMap(this.address)
			},
			// 查看地图
			goMap(data) {
				uni.openLocation({
					latitude: data.lat,
					longitude: data.lng,
					name: data.address,
					// address: data.citynames,
					success: function() {
						console.log('success');
					}
				});
			}
		}
	}
</script>

<style>

</style>
